import CloseCircleFilled from "@ant-design/icons/CloseCircleFilled";
import CheckCircleFilled from "@ant-design/icons/CheckCircleFilled";
import success from '../images/success.png'
import error from '../images/error.png'
import styles from './question_list.module.scss';
import { Question } from "./type";
export default (props: { list: any; }) => {

    function handleClick(questionId: string) {
        window.location.hash = questionId;
    }
    const { list } = props
    return (
        <>
            <div className={styles.title}>考题列表</div>
            <div className={`${styles.list} + " " + ${styles.scroll}`}>
                {list[0].map((item:Question) => (
                    <div key={item.id} onClick={() => {
                        handleClick(item.questionId)
                    }} className={styles.list_item}>
                        <div
                            className={[styles.left, item.state ? styles.success : styles.error].join(" ")}
                        >
                            {item.name}
                        </div>
                        {/* {item.state && <CheckCircleFilled className={styles.right} />}
                        {!item.state && <CloseCircleFilled className={styles.right} />} */}
                        {item.state &&<img src={success} className={styles.right} alt=""/>}
                        {!item.state &&<img src={error} className={styles.right} alt=""/>}
                    </div>
                ))}
            </div>
        </>
    )
}